package com.qms.qep.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.qms.qep.mapper.RepairOrderMapper;
import com.qms.qep.domain.RepairOrder;
import com.qms.qep.service.IRepairOrderService;

/**
 * 维修工单Service业务层处理
 * 
 * @author RepairOrder
 */
@Service
public class RepairOrderServiceImpl implements IRepairOrderService 
{
    @Autowired
    private RepairOrderMapper repairOrderMapper;

    /**
     * 查询维修工单
     * 
     * @param id 维修工单主键
     * @return 维修工单
     */
    @Override
    public RepairOrder selectRepairOrderById(Integer id)
    {
        return repairOrderMapper.selectRepairOrderById(id);
    }

    /**
     * 查询维修工单列表
     * 
     * @param repairOrder 维修工单
     * @return 维修工单
     */
    @Override
    public List<RepairOrder> selectRepairOrderList(RepairOrder repairOrder)
    {
        return repairOrderMapper.selectRepairOrderList(repairOrder);
    }

    /**
     * 新增维修工单
     * 
     * @param repairOrder 维修工单
     * @return 结果
     */
    @Override
    public int insertRepairOrder(RepairOrder repairOrder)
    {
        return repairOrderMapper.insertRepairOrder(repairOrder);
    }

    /**
     * 修改维修工单
     * 
     * @param repairOrder 维修工单
     * @return 结果
     */
    @Override
    public int updateRepairOrder(RepairOrder repairOrder)
    {
        return repairOrderMapper.updateRepairOrder(repairOrder);
    }

    /**
     * 批量删除维修工单
     * 
     * @param ids 需要删除的维修工单主键
     * @return 结果
     */
    @Override
    public int deleteRepairOrderByIds(Integer[] ids)
    {
        return repairOrderMapper.deleteRepairOrderByIds(ids);
    }

    /**
     * 删除维修工单信息
     * 
     * @param id 维修工单主键
     * @return 结果
     */
    @Override
    public int deleteRepairOrderById(Integer id)
    {
        return repairOrderMapper.deleteRepairOrderById(id);
    }
    
    /**
     * 根据缺陷记录ID查询维修工单
     *
     * @param defectRecordId 缺陷记录ID
     * @return 维修工单
     */
    @Override
    public RepairOrder selectRepairOrderByDefectRecordId(Integer defectRecordId)
    {
        return repairOrderMapper.selectRepairOrderByDefectRecordId(defectRecordId);
    }
    
    /**
     * 统计维修工单数量
     *
     * @param repairOrder 维修工单
     * @return 统计结果
     */
    @Override
    public int countRepairOrder(RepairOrder repairOrder)
    {
        return repairOrderMapper.countRepairOrder(repairOrder);
    }
} 